{"ast":null,"code":"import * as React from 'react';\nimport TableContext from \"../context/TableContext\";\nimport { useContextSelector } from \"../ContextSelector\";\nimport HeaderRow from \"./HeaderRow\";\nfunction parseHeaderRows(rootColumns) {\n  var rows = [];\n  function fillRowCells(columns, colIndex) {\n    var rowIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n    // Init rows\n    rows[rowIndex] = rows[rowIndex] || [];\n    var currentColIndex = colIndex;\n    var colSpans = columns.filter(Boolean).map(function (column) {\n      var cell = {\n        key: column.key,\n        className: column.className || '',\n        children: column.title,\n        column: column,\n        colStart: currentColIndex\n      };\n      var colSpan = 1;\n      var subColumns = column.children;\n      if (subColumns && subColumns.length > 0) {\n        colSpan = fillRowCells(subColumns, currentColIndex, rowIndex + 1).reduce(function (total, count) {\n          return total + count;\n        }, 0);\n        cell.hasSubColumns = true;\n      }\n      if ('colSpan' in column) {\n        colSpan = column.colSpan;\n      }\n      if ('rowSpan' in column) {\n        cell.rowSpan = column.rowSpan;\n      }\n      cell.colSpan = colSpan;\n      cell.colEnd = cell.colStart + colSpan - 1;\n      rows[rowIndex].push(cell);\n      currentColIndex += colSpan;\n      return colSpan;\n    });\n    return colSpans;\n  } // Generate `rows` cell data\n\n  fillRowCells(rootColumns, 0); // Handle `rowSpan`\n\n  var rowCount = rows.length;\n  var _loop = function _loop(rowIndex) {\n    rows[rowIndex].forEach(function (cell) {\n      if (!('rowSpan' in cell) && !cell.hasSubColumns) {\n        // eslint-disable-next-line no-param-reassign\n        cell.rowSpan = rowCount - rowIndex;\n      }\n    });\n  };\n  for (var rowIndex = 0; rowIndex < rowCount; rowIndex += 1) {\n    _loop(rowIndex);\n  }\n  return rows;\n}\nfunction Header(_ref) {\n  var stickyOffsets = _ref.stickyOffsets,\n    columns = _ref.columns,\n    flattenColumns = _ref.flattenColumns,\n    onHeaderRow = _ref.onHeaderRow;\n  var _useContextSelector = useContextSelector(TableContext, ['prefixCls', 'getComponent']),\n    prefixCls = _useContextSelector.prefixCls,\n    getComponent = _useContextSelector.getComponent;\n  var rows = React.useMemo(function () {\n    return parseHeaderRows(columns);\n  }, [columns]);\n  var WrapperComponent = getComponent(['header', 'wrapper'], 'thead');\n  var trComponent = getComponent(['header', 'row'], 'tr');\n  var thComponent = getComponent(['header', 'cell'], 'th');\n  var tdComponent = getComponent(['header', 'cell'], 'td');\n  return /*#__PURE__*/React.createElement(WrapperComponent, {\n    className: \"\".concat(prefixCls, \"-thead\")\n  }, rows.map(function (row, rowIndex) {\n    var rowNode = /*#__PURE__*/React.createElement(HeaderRow, {\n      key: rowIndex,\n      flattenColumns: flattenColumns,\n      cells: row,\n      stickyOffsets: stickyOffsets,\n      rowComponent: trComponent,\n      cellComponent: thComponent,\n      tdCellComponent: tdComponent,\n      onHeaderRow: onHeaderRow,\n      index: rowIndex\n    });\n    return rowNode;\n  }));\n}\nexport default Header;","map":{"version":3,"names":["React","TableContext","useContextSelector","HeaderRow","parseHeaderRows","rootColumns","rows","fillRowCells","columns","colIndex","rowIndex","arguments","length","undefined","currentColIndex","colSpans","filter","Boolean","map","column","cell","key","className","children","title","colStart","colSpan","subColumns","reduce","total","count","hasSubColumns","rowSpan","colEnd","push","rowCount","_loop","forEach","Header","_ref","stickyOffsets","flattenColumns","onHeaderRow","_useContextSelector","prefixCls","getComponent","useMemo","WrapperComponent","trComponent","thComponent","tdComponent","createElement","concat","row","rowNode","cells","rowComponent","cellComponent","tdCellComponent","index"],"sources":["/data/messenger.client/node_modules/rc-table/es/Header/Header.js"],"sourcesContent":["import * as React from 'react';\nimport TableContext from \"../context/TableContext\";\nimport { useContextSelector } from \"../ContextSelector\";\nimport HeaderRow from \"./HeaderRow\";\n\nfunction parseHeaderRows(rootColumns) {\n  var rows = [];\n\n  function fillRowCells(columns, colIndex) {\n    var rowIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n    // Init rows\n    rows[rowIndex] = rows[rowIndex] || [];\n    var currentColIndex = colIndex;\n    var colSpans = columns.filter(Boolean).map(function (column) {\n      var cell = {\n        key: column.key,\n        className: column.className || '',\n        children: column.title,\n        column: column,\n        colStart: currentColIndex\n      };\n      var colSpan = 1;\n      var subColumns = column.children;\n\n      if (subColumns && subColumns.length > 0) {\n        colSpan = fillRowCells(subColumns, currentColIndex, rowIndex + 1).reduce(function (total, count) {\n          return total + count;\n        }, 0);\n        cell.hasSubColumns = true;\n      }\n\n      if ('colSpan' in column) {\n        colSpan = column.colSpan;\n      }\n\n      if ('rowSpan' in column) {\n        cell.rowSpan = column.rowSpan;\n      }\n\n      cell.colSpan = colSpan;\n      cell.colEnd = cell.colStart + colSpan - 1;\n      rows[rowIndex].push(cell);\n      currentColIndex += colSpan;\n      return colSpan;\n    });\n    return colSpans;\n  } // Generate `rows` cell data\n\n\n  fillRowCells(rootColumns, 0); // Handle `rowSpan`\n\n  var rowCount = rows.length;\n\n  var _loop = function _loop(rowIndex) {\n    rows[rowIndex].forEach(function (cell) {\n      if (!('rowSpan' in cell) && !cell.hasSubColumns) {\n        // eslint-disable-next-line no-param-reassign\n        cell.rowSpan = rowCount - rowIndex;\n      }\n    });\n  };\n\n  for (var rowIndex = 0; rowIndex < rowCount; rowIndex += 1) {\n    _loop(rowIndex);\n  }\n\n  return rows;\n}\n\nfunction Header(_ref) {\n  var stickyOffsets = _ref.stickyOffsets,\n      columns = _ref.columns,\n      flattenColumns = _ref.flattenColumns,\n      onHeaderRow = _ref.onHeaderRow;\n\n  var _useContextSelector = useContextSelector(TableContext, ['prefixCls', 'getComponent']),\n      prefixCls = _useContextSelector.prefixCls,\n      getComponent = _useContextSelector.getComponent;\n\n  var rows = React.useMemo(function () {\n    return parseHeaderRows(columns);\n  }, [columns]);\n  var WrapperComponent = getComponent(['header', 'wrapper'], 'thead');\n  var trComponent = getComponent(['header', 'row'], 'tr');\n  var thComponent = getComponent(['header', 'cell'], 'th');\n  var tdComponent = getComponent(['header', 'cell'], 'td');\n  return /*#__PURE__*/React.createElement(WrapperComponent, {\n    className: \"\".concat(prefixCls, \"-thead\")\n  }, rows.map(function (row, rowIndex) {\n    var rowNode = /*#__PURE__*/React.createElement(HeaderRow, {\n      key: rowIndex,\n      flattenColumns: flattenColumns,\n      cells: row,\n      stickyOffsets: stickyOffsets,\n      rowComponent: trComponent,\n      cellComponent: thComponent,\n      tdCellComponent: tdComponent,\n      onHeaderRow: onHeaderRow,\n      index: rowIndex\n    });\n    return rowNode;\n  }));\n}\n\nexport default Header;"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,YAAY,MAAM,yBAAyB;AAClD,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,OAAOC,SAAS,MAAM,aAAa;AAEnC,SAASC,eAAe,CAACC,WAAW,EAAE;EACpC,IAAIC,IAAI,GAAG,EAAE;EAEb,SAASC,YAAY,CAACC,OAAO,EAAEC,QAAQ,EAAE;IACvC,IAAIC,QAAQ,GAAGC,SAAS,CAACC,MAAM,GAAG,CAAC,IAAID,SAAS,CAAC,CAAC,CAAC,KAAKE,SAAS,GAAGF,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;IACpF;IACAL,IAAI,CAACI,QAAQ,CAAC,GAAGJ,IAAI,CAACI,QAAQ,CAAC,IAAI,EAAE;IACrC,IAAII,eAAe,GAAGL,QAAQ;IAC9B,IAAIM,QAAQ,GAAGP,OAAO,CAACQ,MAAM,CAACC,OAAO,CAAC,CAACC,GAAG,CAAC,UAAUC,MAAM,EAAE;MAC3D,IAAIC,IAAI,GAAG;QACTC,GAAG,EAAEF,MAAM,CAACE,GAAG;QACfC,SAAS,EAAEH,MAAM,CAACG,SAAS,IAAI,EAAE;QACjCC,QAAQ,EAAEJ,MAAM,CAACK,KAAK;QACtBL,MAAM,EAAEA,MAAM;QACdM,QAAQ,EAAEX;MACZ,CAAC;MACD,IAAIY,OAAO,GAAG,CAAC;MACf,IAAIC,UAAU,GAAGR,MAAM,CAACI,QAAQ;MAEhC,IAAII,UAAU,IAAIA,UAAU,CAACf,MAA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